<template>
    <div>
        <h3>{{ msg }}</h3>
		<div>
			<table v-for="(item, index) in goodslist" border="1">
				<tr >
					<img :src="'http://127.0.0.1:8000/static/upload/' + item.img" alt="" width="100">
					<td>
						{{item.name}}
						{{item.desc}}
					</td>
					<td>收货人：xing</td>
					<td>支付金额￥ {{item.price}}</td>
					<td><Button @click="submit">评论</Button></td>
				</tr>
			</table>
		</div>
    </div>
</template>

<script>
export default {
    data () {
        return {
            msg: '商品列表页',
            username: '',
			password: '',
			// 商品列表
			goodslist: [],
        }
    },

    //钩子方法
    mounted:function(){
		// 请求商品接口
		// 发送请求
		this.axios.get('http://127.0.0.1:8000/goodslist/', {
		})
		.then((result) => {
			console.log(result);
			this.goodslist = result.data.data;
		})
    },

    //自定义方法
    methods:{
		submit: function () {
			this.$router.push('/item')
		}
    },
}
</script>

<style>
    
</style>
